package com.study.hystrix;

import rx.Observable;

import java.util.Iterator;

public class HystrixObservableCommandDemoTest {

    public static void testObservable() {
        Observable<String> observable = new HystrixObservableCommandDemo("World").observe();

        Iterator<String> iterator = observable.toBlocking().getIterator();
        while (iterator.hasNext()) {
            System.out.println(iterator.next());
        }
    }

    public static void testToObservable() {
        Observable<String> observable = new HystrixObservableCommandDemo("World").toObservable();
        Iterator<String> iterator = observable.toBlocking().getIterator();
        while (iterator.hasNext()) {
            System.out.println(iterator.next());
        }
    }

    public static void main(String[] args) {
        testObservable();
        testToObservable();
    }
}
